/*
 * ProtocolSender.h
 *
 *  Created on: Sep 8, 2017
 *      Author: guoxs
 */

#ifndef _UART_PROTOCOL_SENDER_H_
#define _UART_PROTOCOL_SENDER_H_

#include "uart/CommDef.h"
#include "system/Thread.h"
#include <cstring>

class Response : public Thread {
public:

    Response();
    static Response* getInstance();
    void sendData(int DataType, const BYTE *pData, BYTE len);

protected:
    virtual bool readyToRun() override;
    virtual bool threadLoop() override;
private:
    bool sendProtocolTo();
    void stop();

    int uart;
    int DataType;
    BYTE pData[128]; // 最大长度为128字节
    BYTE len;
    int Count;

};

#define RESPONSE Response::getInstance()

#endif /* _UART_PROTOCOL_SENDER_H_ */
